﻿<!DOCTYPE html>
<html>
<head>
  <title>欢迎首页</title>
     $css()
    <style type="text/css">
      body{ margin: 1em 2em;}
      h1{text-align:center;}
      
    .border{border:solid 1px #ddd;margin:5px 0;background:#fff;}
        .border .title {
            background: #f5f5f5;
            padding: 0 5px;
            line-height: 23px;
            font-weight: bold;
            color: #333;
            background: transparent linear-gradient(to bottom, #F7F8FA, #E7E9EC);
            border-bottom: solid 1px #ddd;
        }
    .border .title span{padding-left:20px;background:url(/public/assets/icons/admin/file.gif) left center no-repeat;}

    dl{line-height:22px;border-bottom:dotted 1px #e0e0e0;margin:0;}
    dl dt{width:100px;float:left;text-align:left;color:#666;
          border-right:dotted 1px #e0e0e0;margin-right:10px;font-weight:bold;
          padding-left:30px;padding-top:5px;padding-bottom:5px;
    }
    dl dd{color:#666;padding-top:5px;padding-bottom:5px;}
    
    #dialog_server{width:59%;margin-left:-60%;float:right;}
   .leftPart{width:40%;float:left;margin-right:60%;}

    #dialog_rss .border{ height: 257px;overflow: hidden;}

    .new-version,.curr-version{ color: #0a0;}
    .no-version{color:#F00;}
    iframe{ background: #FFF;}
    a.button{ background: #fff;padding: 0 5px;margin: 0 10px;color: #FFF;background: #0a0;}
        em.impo {
            font-size: 0.8em;
            color: #ff0000;
            font-style: normal;
            border: solid 1px #FFC000;
            padding: 0 5px;
            background: #FFE;
            margin: 2em 0 1em 0;
            display: block;
        }
  </style>
</head>
<body>



        <div id="dialog_server">
            <div class="border">
                <div class="title"><span>服务器状态</span></div>
                <dl><dt>服务器名称：</dt><dd>${server_name}( IP:${server_ip} )</dd></dl>
                <dl><dt>操作系统：</dt><dd>${server_os},语言：${server_local}</dd></dl>
                <dl><dt>服务器软件:</dt><dd>${server_iis}(.NET版本：${server_netver})</dd></dl>
                <dl><dt>服务器时间:</dt><dd>${server_time}</dd></dl>
                <dl><dt>开机时长:</dt><dd>${server_hour}</dd></dl>
                <dl><dt>CPU类型:</dt><dd>${server_cpu}</dd></dl>
                <dl><dt>内存占用:</dt><dd>${server_net_meory}<!--${server_meory}--></dd></dl>
                <dl><dt>本机IP:</dt><dd>${person_ip}</dd></dl>
                <dl><dt>本机系统:</dt><dd>${person_os}</dd></dl>
                <dl style="border: none"><dt>浏览器:</dt><dd>${person_soft} (版本:${person_softver})</dd></dl>
            </div>
        </div>


<div class="leftPart">
    <div id="dialog_patch" class="border" style="height: auto">
        <div class="title"><span>系统概况</span></div>
        <dl>
            <dt>软件版本</dt>
            <dd>
                ${soft_ver}&nbsp;&nbsp;&nbsp;&nbsp;
                <span id="version"></span>
            </dd>
        </dl>
        <dl style="border: none"><dt>授权用户:</dt><dd>${sys_alias}</dd></dl>
    </div>


    <div id="dialog_rss">
        <div class="border">
            <div class="title"><span>系统资讯</span></div>
            <iframe to="${shortServer}_dash_info" src="about:blank" frameborder="0" width="100%" height="100%"></iframe>
        </div>
    </div>

</div>


<div class="clear-fix" style="border:solid 1px #ddd">
    <iframe to="${shortServer}_dash_fla" src="about:blank" frameborder="0" width="100%" height="160"></iframe>
</div>

$js()
    <script type="text/javascript">

        var dia;
        var versionInfo;
        window.autoCheck = true;
        var install_finish=false;

        jr.xhr.filter = null;
		function checkUpgrade(){
		    var e = jr.$('version');
		    e.innerHTML = '正在从服务器获取版本...';
		    e.className = '';
		    jr.xhr.get('?module=ajax&action=checkupgrade', function (rsp) {
		        var ver = jr.toJson(rsp);
                if (ver.result === 1) {
                    e.className = 'new-version';
                    e.innerHTML = '新版本可升级：v' + ver.version + '&nbsp;<a class="button" href="javascript:;" onclick="confirmUpgrade(false)">点击升级</a>';
                	versionInfo=ver.log;
                } else {
                    if (ver.result === -1) {
                        e.className = 'curr-version';
                        e.innerHTML = ver.message;
                    } else {
                        e.className = 'no-version';
                        e.innerHTML = ver.message + '&nbsp;<a class="button" href="javascript:;" onclick="checkUpgrade()">检查更新</a>';
                    }
                }
               });
		}
		
        function confirmUpgrade(noVersionShow) {
            dia = jr.dialog.create2('系统升级', true, true);
            var html = '<strong>更新日志:</strong><hr class="upline"/><p>' + versionInfo + '</p>';
           dia.write('<div style="color:#666;font-size:14px;line-height:25px;padding:20px 40px;">' + html
               + '<div style="color:#666;font-size:12px;margin:10px 0 0 0"><span style="color:#FF0000">重要：</span><span>'
                +'由于系统各异,无法保证均能升级成功！如升级失败，请联系管理员解决！</span></div>'
               + '<div style="margin-bottom:15px;"><br /><button id="btn_install" style="padding:0 2em">开始升级</button></div></div>');
           (window.parent||window).document.getElementById('btn_install').onclick = upgrade;
        }


        function upgrade() {
            window.autoCheck = false;
            if (dia != null)dia.close();
            dia = jr.dialog.create2('请等待，系统升级中...', true, true);
            dia.write('<div style="width:400px;overflow:hidden;position:relative;background:#333;">' +
                       '<div style="position:absolute;left:160px;top:0px;line-height:24px;color:#ffff00;font-family:Arial;font-weight:bold;">0%</div>'+
                        '<div id="updatePercent" style="background:orange;line-height:24px;width:0%;overflow:hidden;">&nbsp;</div></div>'
                        , 400, 20, null, '提示：升级中请勿进行任何操作...</span>', true);
            var e = (window.parent||window).document.getElementById('updatePercent');
            setUpgradeStatus(e, 0);

            //开始更新
            jr.xhr.post('?', 'module=ajax&action=getupgrade', function (x) {});
        }

        function setUpgradeStatus(e, percent) {
            var width = e.offsetWidth;
            var pwidth = e.parentNode.offsetWidth;
            e.style.width = (pwidth * percent) + 'px';
            if (width < pwidth && percent !== 1) {
                e.previousSibling.innerHTML = '下载升级包：' + parseInt(percent * 100) + '%';
                setTimeout(function() {
                    jr.xhr.get('?module=ajax&action=getUpgradeStatus', function (x) {
                        setUpgradeStatus(e, parseFloat(x));
                    });
                }, 1000);
            } else {
                var ele=e.previousSibling;
                ele.innerHTML = "正在升级...";
                jr.xhr.get('?', function (x) {
                    ele.innerHTML = "升级成功";
                    setTimeout(function () { if (dia != null) { dia.close(); location.reload(); } }, 5000);
                }, function (x) {
                    ele.innerHTML = '<span style="color:red">系统无法升级，请联系管理员修复！</span>';
                });
                
            }
        }
        checkUpgrade();

        window.onload = function() {
            jr.each(document.getElementsByTagName("IFRAME"), function(i, e) {
                e.src = e.getAttribute('to');
            });
        };
    </script>

</body>
</html>
